﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsForms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string str = "12,2,3,4,0,";
            int i = str.IndexOf(' ');

        }

        private string FormatZPCount(string strZPCount)
        {
            /*
             * 问题：如果输入的都是逗号,会返回空字符串
             */

            //去掉首位空格
            strZPCount = strZPCount.Trim();
            //将中文逗号改为英文逗号
            strZPCount = strZPCount.Replace("，", ",");
            //去掉开头的逗号
            while (strZPCount.Length>0 && strZPCount.Substring(0, 1) == ",")
            {
                strZPCount = strZPCount.Substring(1, strZPCount.Length - 1);
            }
            //去掉结尾的逗号
            while (strZPCount.Length>0 && strZPCount.Substring(strZPCount.Length - 1) == ",")
            {
                strZPCount = strZPCount.Substring(0, strZPCount.Length - 1);
            }

            return strZPCount;
        }

        class info
        {
            public string ID { get; set; }
            public string vcName { get; set; }
            public int iCount { get; set; }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string strID = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            string strID2 = this.dataGridView1.SelectedRows[0].Cells["ID"].Value.ToString();

            string strName = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            string strName2 = this.dataGridView1.SelectedRows[0].Cells["vcName"].Value.ToString();
        }
    }
}
